﻿using NLog;
using System;



public class Logger
{

    private static readonly NLog.Logger loginfo = LogManager.GetLogger("loginfo");
    private static readonly NLog.Logger logerror = LogManager.GetLogger("logerror");
    private static readonly NLog.Logger logmqtt = LogManager.GetLogger("logmqtt");
    private static readonly NLog.Logger logWHX = LogManager.GetLogger("logWHX");

    private static readonly NLog.Logger logsInfo = LogManager.GetLogger("logsInfo");
    private static readonly NLog.Logger logsMEStIME = LogManager.GetLogger("logsMEStIME");
    private static readonly NLog.Logger logsSql = LogManager.GetLogger("logsSql");
    private static readonly NLog.Logger logsSysErrorLog = LogManager.GetLogger("logsSysErrorLog");
    private static readonly NLog.Logger logsSysErrorLogcn = LogManager.GetLogger("logsSysErrorLogcn");
    public static void WriteInfo(string info)
    {
        Console.WriteLine(info);
        if (loginfo.IsInfoEnabled)
        {
            loginfo.Info(info);
        }
    }

    public static void WriteMqtt(string info)
    {
        Console.WriteLine(info);
        if (logmqtt.IsInfoEnabled)
        {
            logmqtt.Info(info);
        }
    }

    public static void WriteError(string error)
    {
        Console.WriteLine(error);
        if (logerror.IsErrorEnabled)
        {
            logerror.Error(error);
        }
    }

    public static void WriteError(string info, Exception ex)
    {
        Console.WriteLine(info);
        if (logerror.IsErrorEnabled)
        {
            logerror.Error(info, ex);
        }
    }
    public static void WriteWHX(string info)
    {
        Console.WriteLine(info);
        if (logWHX.IsErrorEnabled)
        {
            logWHX.Error(info);
        }
    }
}

